<div class="card">
    <div class="card-body">
        @if($posts)
            <div class="list-group list-group-flush">
                @foreach($posts as $post)
                    <a class="list-group-item d-block post-list-item" href="{{$post->link()}}">

                        @if(!empty($post->image))
                            <div class="media">
                                <img class="mr-3" src="{{asset("storage/".$post->image)}}" style="width: 90px;height: 90px;border-radius: 4px"/>
                                <div class="media-body">
                                    @if($post->category)
                                        <span class="badge badge-info float-right post-category">{{$post->category->name}}</span>
                                    @endif
                                    <h4 class="multi-line-2">{{$post->title}}</h4>
                                    <p class="multi-line-3">{{$post->excerpt}}</p>
                                </div>
                            </div>
                        @else
                            <div class="media">
                                <div class="media-body">
                                    <p class="multi-line-3">{{$post->excerpt}}</p>
                                </div>
                            </div>
                        @endif
                        <p class="card-subtitle font-weight-normal second-title">{{$post->user->name}}<span style="margin-left: 10px;">{{$post->updated_at ? $post->created_at->diffForHumans(): ''}}</span></p>


                    </a>
                @endforeach
            </div>
            {!! $posts->render() !!}
        @endif

    </div>
</div>
